package com.nf.action;

import com.nf.entity.Student;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class TestAction {
    @RequestMapping("/zzz")
    public String a(Model model,String username){
        System.out.println(username);
        String pp = username + "buhao";
        model.addAttribute("pp",pp);
        return "a1";
    }

    @RequestMapping("/c")
    public String c(){
        return "a1";
    }
    @RequestMapping("/d")
    public String d(){
        return "a3";
    }

    @ResponseBody
    @RequestMapping("/json1")
    public Student b(String name,Integer age){
        Student student = new Student();
        student.setName(name);
        student.setAge(age);
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return student;
    }
}
